Optimal Representations for Covariate Shift