Inverse problem for multivariate time series using dynamical latent variables