Just run the following query on your WordPress database, and all categories will be turned into tags. Don't forget to replace the table prefix wp_ if your database is using another prefix.
And of course, do not forget to make a backup of your database before running the query!
UPDATE wp_term_taxonomy SET taxonomy='post_tag', parent=0 WHERE taxonomy='category';
Thanks to Go WordPress for the tip!