Learning Data Representations with Joint Diffusion Models