def METHOD_NAME(
    cls, data: dict[str, Any], reddit: praw.Reddit
) -> Message | SubredditMessage:
    """Return an instance of :class:`.Message` or :class:`.SubredditMessage` from ``data``.
    :param data: The structured data.
    :param reddit: An instance of :class:`.Reddit`.
    """
    if data["author"]:
        data["author"] = Redditor(reddit, data["author"])
    if data["dest"].startswith("#"):
        data["dest"] = Subreddit(reddit, data["dest"][1:])
    else:
        data["dest"] = Redditor(reddit, data["dest"])
    if data["replies"]:
        replies = data["replies"]
        data["replies"] = reddit._objector.objectify(replies["data"]["children"])
    else:
        data["replies"] = []
    if data["subreddit"]:
        data["subreddit"] = Subreddit(reddit, data["subreddit"])
        return SubredditMessage(reddit, _data=data)
    return cls(reddit, _data=data)