Persistent homology detects curvature