The need for this came up in discussion around #1448 in https://github.com/ocaml/dune/pull/1448#issuecomment-475471211. I expect we'll want a function `Dune_File.Stanzas.of_ast`, likely implemented on top of a `Dune_File.Stanza.of_ast`.