Learning Discrete and Continuous Factors of Data via Alternating Disentanglement