Observation of geometric and dynamical phases by neutron interferometry