Crossover between non-Markovian and Markovian dynamics induced by a hierarchical environment