Both are ok and can be translated to english in the same way.
But I do not remember grammar enough to explain the difference.