Sliced Inverse Regression in Metric Spaces