Learning Tree Distributions by Hidden Markov Models