On the controllability of the quantum dynamics of closed and open systems