Converts an ndarray into an array-of-arrays