Robust modeling of within-and across-area population dynamics using recurrent neural networks