Domain Generalization via Invariant Representation under Domain-Class Dependency