Cancer as a dynamical phase transition