Characterization of a class of embeddings for function spaces with Muckenhoupt weights