Learning invariant representations of time-homogeneous stochastic dynamical systems