Functional networks provide a topological description of activity patterns in the brain, as they stem from the propagation of neural activity on the underlying anatomical or structural network of synaptic connections. This latter is well known to be organized in hierarchical and modular way. While it is assumed that structural networks shape their functional counterparts, it is also hypothesized that alterations of brain dynamics come with transformations of functional connectivity. In this computational study, we introduce a novel methodology to monitor the persistence and breakdown of hierarchical order in functional networks, generated from computational models of activity spreading on both synthetic and real structural connectomes. We show that hierarchical connectivity appears in functional networks in a persistent way if the dynamics is set to be in the quasi-critical regime associated with optimal processing capabilities and normal brain function, while it breaks down in other (supercritical) dynamical regimes, often associated with pathological conditions. Our results offer important clues for the study of optimal neurocomputing architectures and processes, which are capable of controlling patterns of activity and information flow. We conclude that functional connectivity patterns achieve optimal balance between local specialized processing (i.e. segregation) and global integration by inheriting the hierarchical organization of the underlying structural architecture.