A Variational Approximation for Bayesian Networks with Discrete and Continuous Latent Variables