Quadratic obstructions to controllability: from ODEs to PDEs