I've managed it maybe twice over a couple hundred games.
The easiest way to get a "voluntary" vassal is to be so overpoweringly strong that you can 'Demand' it and they have no choice but to accept. This will basically only ever happen if you manage to get them into the "Afraid" status, which is extremely difficult, and even then it's not a guarantee.
Sometimes you can get a voluntary vassal if they're being wiped from the Earth by another civ and you approach them after they lose their capital.
As for the AI doing it, well... that's some bulls*** that you mostly can't replicate. If you go down the list and ask every single civ, every single turn for the entire game, you MIGHT find them willing. Otherwise, just forget it's an option.