Abrupt transition between Markovian and non-Markovian dynamics in quantum open systems