Reconstruction of groupoids and C*-rigidity of dynamical systems