Metadata API commands allow you to convert the retrieved source code from the Metadata API to the Salesforce DX project format. To retrieve the source code from your Org, you can use mdapi:retrieve.
If you already have an unmanaged package, managed package, or existing source code in your Orgs, you can use mdapi:retrieve to retrieve them to a ZIP format and then use mdapi:convert to convert them to DX format.