Tensor networks as a data structure in probabilistic modelling and for learning dynamical laws from data