Domain Generalization under Conditional and Label Shifts via Variational Bayesian Inference