Convert a tree containing only basic data types, annotated with tags, to a tree containing custom data types.