I've done no special setup. I am on Project Fi, which has had this capability for a year or more. One requirement is that the network not only not be secured with a password but also not a "captive portal" network that requires accepting an agreement to connect. At least, this is how it was with Fi, and it automatically connected and secured those networks, even if I hadn't connected to it before.
My most recent experience was 10 days ago. I had the wireless network at Citi Field saved as I had been there previously. My phone connected when I was in range (in the parking lot) and I was prompted with a notification in the notification shade to secure the connection.