Either one can connect to the display, but the Macbook cannot use its maximum resolution.
The Macbook cannot display a resolution higher than 1920x1080 (1080p) on whatever screen is connected, even if that screen supports something higher.
The Macbook Pro can display resolutions up to 2048x1536.