Calculate the covariance between points in X.
If X_T is not provided, a copy of X will be made in this function.